package com.moli.iov.admin.service.impl;

import com.moli.iov.admin.service.AlarmEquipmentRecordService;
import com.moli.iov.base.model.dto.req.AlarmEquipmentRecordDto;
import com.moli.iov.base.model.dto.res.AlarmEquipmentRecordResDto;
import com.moli.iov.base.remote.IAlarmEquipmentRecordRemoteService;
import com.moli.iov.model.dto.req.PageExtend;
import com.moli.iov.rest.RestResponse;
import com.moli.iov.util.DateUtil;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.annotation.Service;

/**
 * 报警管理 > 设备变更报警
 *
 * @author wanghualin
 * @date 2019-09-27 13:25:00
 */
@Service
public class AlarmEquipmentRecordServiceImpl implements AlarmEquipmentRecordService {

  @Reference(group = "${service.group}",check = false)
  private IAlarmEquipmentRecordRemoteService alarmEquipmentRecordRemoteService;

  @Override
  public PageExtend<AlarmEquipmentRecordResDto> listEquipmentRecord(
      AlarmEquipmentRecordDto dto) {
    if (dto.getEndTime()!=null){
      dto.setEndTime( DateUtil.addDateEndfix(dto.getEndTime()));
    }
    return alarmEquipmentRecordRemoteService.listEquipmentRecord(dto);
  }

  @Override
  public RestResponse updateAlarmEquipmentRecord(AlarmEquipmentRecordDto dto) {
    return alarmEquipmentRecordRemoteService.updateAlarmEquipmentRecord(dto);
  }
}
